package com.cold.demo.jxls;

import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.ss.usermodel.CellStyle;
import org.jxls.template.SimpleExporter;
import org.jxls.util.CellRefUtil;

import java.io.*;
import java.util.*;

/**
 * XSSFCellStyle xls
 * HSSFCellStyle xlsx
 * @author: zyc
 */
public class Test {
    public static void main(String[] args) throws Exception {
        InputStream         is    = Test.class.getResourceAsStream("/测试.xlsx");
        OutputStream        os    = new FileOutputStream("D:\\Users\\zyc\\Desktop\\fsdownload\\" + System.currentTimeMillis() + ".xlsx");
        Map<String, Object> model = new HashMap<>();
        model.put("name", "周银昌");

        JxlsUtil.exportExcel(is, os, model);


    }

    public static CellStyle getCellStyle(){

        return null;
    }

    public static void simpleExporter() throws Exception {
        List<Map<String, Object>> list = new ArrayList<>();
        Map<String, Object>       map  = new HashMap<>();
        map.put("cell", "qwertyuio");
        map.put("name", "zyc");
        list.add(map);

        SimpleExporter simpleExporter = new SimpleExporter();
        Iterable       iterable       = Arrays.asList("123", "234", "234", "234", "234", "234", "234", "234", "234", "234", "234", "234", "234", "234", "234", "234");
        Iterable       data           = list;
        String         s              = "cell,name,";
        simpleExporter.gridExport(iterable, data, s, new FileOutputStream("D:\\Users\\zyc\\Desktop\\fsdownload\\" + System.currentTimeMillis() + ".xlsx"));
    }
}
